﻿
    <ResourceDictionary x:Class="OpenLS.Spreadsheet.UI.PageMarginsResources"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:Spreadsheet="clr-namespace:OpenLS.Spreadsheet;assembly=OpenLS.Spreadsheet"
                    xmlns:Internals="clr-namespace:OpenLS.Spreadsheet.UI.Internals" 
                    xmlns:UI="clr-namespace:OpenLS.UI;assembly=OpenLS.UI" xmlns:UI1="clr-namespace:OpenLS.Spreadsheet.UI"
                        xmlns:Resources="clr-namespace:OpenLS.Spreadsheet.UI.Internals.Resources">
	<DataTemplate DataType="{x:Type Spreadsheet:PageMargins}">
		<Grid>
		<Grid.Resources>
                <Style TargetType="{x:Type Label}" x:Key='colonLabel'>
                    <Setter Property='Template'>
                        <Setter.Value>
                            <ControlTemplate TargetType='{x:Type Label}'>
                                <StackPanel Orientation='Horizontal'>
                                    <TextBlock  Foreground="{DynamicResource {x:Static UI:OfficeBrushes.TextForegroundKey}}" Text='{TemplateBinding Content}'/>
                                    <TextBlock Foreground="{DynamicResource {x:Static UI:OfficeBrushes.TextForegroundKey}}"  Text=":"/>
                                </StackPanel>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
                <Style TargetType="{x:Type Label}" x:Key='inchesLabel'>
                    <Setter Property="Margin" Value="0 0 5 0"/>
                    <Setter Property='Template'>
                        <Setter.Value>
                            <ControlTemplate TargetType='{x:Type Label}'>
                                    <TextBlock Foreground="{DynamicResource {x:Static UI:OfficeBrushes.TextForegroundKey}}">
                                    	<TextBlock.Text>
                                    		<Binding RelativeSource="{RelativeSource TemplatedParent}" Path="Content">
                                            <Binding.Converter>
                                                <UI1:PixesToInchesConverter></UI1:PixesToInchesConverter></Binding.Converter>
                                    		</Binding>
                                    	</TextBlock.Text>
                                    </TextBlock>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </Grid.Resources>
            <Grid.ColumnDefinitions>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
                <ColumnDefinition></ColumnDefinition>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
                <RowDefinition></RowDefinition>
            </Grid.RowDefinitions>
            <Label Style="{StaticResource colonLabel}" Content="{x:Static Resources:UIStringTable.Top}" Grid.Column="0" Grid.Row="0"></Label>
            <Label Style="{StaticResource inchesLabel}" Grid.Column="1" Grid.Row="0" Content="{Binding Top}"></Label>
            <Label Style="{StaticResource colonLabel}" Content="{x:Static Resources:UIStringTable.Bottom}" Grid.Column="2" Grid.Row="0"></Label>
            <Label Style="{StaticResource inchesLabel}" Grid.Column="3" Grid.Row="0" Content="{Binding Bottom}"></Label>
            <Label Style="{StaticResource colonLabel}" Content="{x:Static Resources:UIStringTable.Left}" Grid.Column="0" Grid.Row="1"></Label>
            <Label Style="{StaticResource inchesLabel}" Grid.Column="1" Grid.Row="1" Content="{Binding Left}"></Label>
            <Label Style="{StaticResource colonLabel}" Content="{x:Static Resources:UIStringTable.Right}" Grid.Column="2" Grid.Row="1"></Label>
            <Label Style="{StaticResource inchesLabel}" Grid.Column="3" Grid.Row="1" Content="{Binding Right}"></Label>
            <Label Style="{StaticResource colonLabel}" Content="{x:Static Resources:UIStringTable.Header}" Grid.Column="0" Grid.Row="2"></Label>
            <Label Style="{StaticResource inchesLabel}" Grid.Column="1" Grid.Row="2" Content="{Binding Header}"></Label>
            <Label Style="{StaticResource colonLabel}" Content="{x:Static Resources:UIStringTable.Footer}" Grid.Column="2" Grid.Row="2"></Label>
            <Label Style="{StaticResource inchesLabel}" Grid.Column="3" Grid.Row="2" Content="{Binding Footer}"></Label>
        </Grid>
	</DataTemplate>
    
</ResourceDictionary>
